home *** CD-ROM | disk | FTP | other *** search
- /*
- IXBTree.h
- Copyright 1991, NeXT, Inc.
- */
-
- #import <mach/cthreads.h>
- #import <objc/Object.h>
-
- #import "protocols.h"
-
- #import <store/IXStoreFile.h>
-
- #ifdef NX_COMPILER_RELEASE_3_0
- @interface IXBTree: Object <IXNameAndFileAccess, IXComparatorSetting, IXComparisonSetting>
- #else NX_COMPILER_RELEASE_3_0
- @interface IXBTree: Object
- #endif NX_COMPILER_RELEASE_3_0
- {
- @public
- struct mutex mutexLock; // public for explicit locking
- #ifdef NX_COMPILER_RELEASE_3_0
- @protected
- #endif NX_COMPILER_RELEASE_3_0
- vm_offset_t _rootOffset;
- unsigned _recordCount;
- unsigned _syncVersion;
- unsigned _codeVersion;
- unsigned _blockShift;
- unsigned _btreeDepth;
- boolean_t _freeStore;
- char *_handleName;
- unsigned _handle;
- IXStore *_store;
- IXComparator *_comparator;
- void *_context;
- char *_comparison;
- struct BTreeStore *_btreeStore;
- struct {
- unsigned isSpanning:1;
- unsigned rightRotation:1;
- unsigned leftRotation:1;
- } _cursorStatus;
- }
-
- // Returns the store, e.g., [[client store] startTransaction].
- - (IXStore *)store;
-
- - (unsigned)count; // returns the number of key/record pairs
- - empty; // removes all key/record pairs
-
- - compact; // this method is not implemented, but remains for compatibility
- - (unsigned)keyLimit; // returns the maximum key length
-
- - optimizeForTime; // faster insertion, more empty space per page
- - optimizeForSpace; // slower insertion, less empty space per page
-
- // This method causes records to span node boundaries for optimal space
- // utilization. It renders the resulting B* tree unchangeable, however, and
- // attempting to modify a spanned B* tree will produce an exception. The
- // records must be added to the B* tree in key order when spanning is enabled.
-
- - setSpanning:(BOOL)flag;
-
- // These macros accquire and release the public mutex lock instance variable.
- // The lock is advisory only. Callers must cooperate to obtain thread safety.
-
- #define IXLockBTreeMutex(btree) mutex_lock(&(btree)->mutexLock)
- #define IXUnlockBTreeMutex(btree) mutex_unlock(&(btree)->mutexLock)
-
- @end
-